# Contributor: Yejun Yang yejunx AT gmail DOT com

pkgname=ziproxy
pkgver=3.2.0
pkgrel=1
pkgdesc="forwarding, non-caching, compressing HTTP proxy server"
arch=('i686' 'x86_64')
url="http://ziproxy.sourceforge.net/"
license=('GPLv2')
depends=('giflib' 'libpng' 'libjpeg' 'zlib' 'jasper')
backup=(etc/ziproxy/ziproxy.conf
	etc/ziproxy/bo_exception.list
	etc/ziproxy/http.passwd
	etc/ziproxy/noprocess.list
	etc/ziproxy/replace.list
	etc/xinetd.d/ziproxy
	var/lib/ziproxy/error/400.html
	var/lib/ziproxy/error/404.html
	var/lib/ziproxy/error/407.html
	var/lib/ziproxy/error/408.html
	var/lib/ziproxy/error/409.html
	var/lib/ziproxy/error/500.html
	var/lib/ziproxy/error/503.html)
install=ziproxy.install
source=(http://downloads.sourceforge.net/project/ziproxy/ziproxy/ziproxy-$pkgver/ziproxy-$pkgver.tar.bz2
	ziproxy
	ziproxy.logrotate
	ziproxy.xinetd)
md5sums=('fb5fd0ba0ddd8412cd3a767ac63075ff'
         '41108c6c91481053947c39615fd6f165'
         '89a6728369715aff18bc0863f3e62fe5'
         '3d2f9208b5ab6738c136049e1fd2e433')

build() {
  cd $srcdir/$pkgname-$pkgver

  [ $NOEXTRACT -eq 1 ] || ./configure --prefix=/usr --with-jasper
  make
  make DESTDIR=$pkgdir install

  install -d $pkgdir/var/lib/ziproxy/error
  install -d $pkgdir/etc/conf.d
  install -d $pkgdir/etc/rc.d

  sed -i 's#var/ziproxy#var/lib/ziproxy#' etc/ziproxy/ziproxy.conf
  cp -a etc/ziproxy $pkgdir/etc/ziproxy
  install -m644 var/ziproxy/error/* $pkgdir/var/lib/ziproxy/error
  echo "ZIPROXY_ARGS=\"-c /etc/ziproxy/ziproxy.conf\"" >$pkgdir/etc/conf.d/ziproxy
  install -m755 $srcdir/ziproxy $pkgdir/etc/rc.d
  install -Dm0644 $srcdir/ziproxy.logrotate $pkgdir/etc/logrotate.d/ziproxy
  install -Dm0644 $srcdir/ziproxy.xinetd $pkgdir/etc/xinetd.d/ziproxy
}
